<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>Aloha Editor command insertorderedlist tests</title>
	<!-- include qunit -->
	<link rel="stylesheet" href="../vendor/qunit.css" type="text/css"/>

	<script type="text/javascript" src="../vendor/qunit.js"></script>

	<!-- include jquery -->
	<script	src="../../lib/vendor/jquery-3.7.0.js" ></script>
	<script type="text/javascript" src="../vendor/jquery.simulate.js"></script>

	<!-- include aloha -->
	<script>
		var Aloha = {
			settings: {
				jQuery: $,
				baseUrl: '../../lib'
			}
		};
	</script>
	<script src="../../lib/require.js"></script>
	<script src="../../lib/aloha.js" data-aloha-plugins="common/ui,common/list,common/format"></script>

	<script>
		// load command test suite
		require( ['commandtest'] );
	</script>
	<style type="text/css">
		.aloha-editable ol li { list-style-type: decimal; margin: 1.5em; }
		.aloha-editable ol li ol li{ list-style-type: decimal; margin: 2em; }
	</style>
</head>
<body>
	<!-- include the tests -->
	<script>
	var tests = {
		defaultCommand: 'insertorderedlist',
		tests: [
			{	exclude: ['msie7.0', 'msie8.0'],
				start: '<p>{}<br/></p>',
				execResult: '<ol><li>{}<br/></li></ol>'
			},
			{	exclude: ['msie7.0', 'msie8.0'],
				start: '<ol><li>{}<br/></li></ol>',
				execResult: '<p>{}<br/></p>'
			},
			{	include: ['msie7.0', 'msie8.0'],
				start: '<ol><li>{}</li></ol>',
				execResult: '<p>{}</p>'
			},
			{	start: '<ul><li>{}</li></ul>',
				execResult: '<ol><li>{}</li></ol>'
			},

			// single line at end
//			{	start: 'foo[]',
//				execResult: '<ol><li>foo[]</li></ol>'
//			},
			{	start: '<p>foo[]</p>',
				execResult: '<ol><li>foo[]</li></ol>'
			},
			{	start: '<ol><li>foo[]</li></ol>',
				execResult: '<p>foo[]</p>'
			},
			{	start: '<ul><li>foo[]</li></ul>',
				execResult: '<ol><li>foo[]</li></ol>'
			},

			// single line at start
//			{	start: '[]foo',
//				execResult: '<ol><li>[]foo</li></ol>'
//			},
			{	start: '<p>[]foo</p>',
				execResult: '<ol><li>[]foo</li></ol>'
			},
			{	start: '<ol><li>[]foo</li></ol>',
				execResult: '<p>[]foo</p>'
			},
			{	start: '<ul><li>[]foo</li></ul>',
				execResult: '<ol><li>[]foo</li></ol>'
			},

			// single line fully selected
			{	start: '[foo]',
				execResult: '<ol><li>[foo]</li></ol>'
			},
			{	start: '<p>[foo]</p>',
				execResult: '<ol><li>[foo]</li></ol>'
			},
			{	start: '<ol><li>[foo]</li></ol>',
				execResult: '<p>[foo]</p>'
			},
			{	start: '<ul><li>[foo]</li></ul>',
				execResult: '<ol><li>[foo]</li></ol>'
			},

			// two lines at end of first
//			{	exclude: ['msie'],
//				start: 'foo[]<br/>bar',
//				execResult: '<ol><li>foo[]</li></ol>bar'
//			},
            {	include: ['msie'],
				start: 'foo[]<br/>bar',
                execResult: '<ol><li>foo[]<br/></li></ol>bar'
			},
			{	start: '<p>foo[]</p><p>bar</p>',
				execResult: '<ol><li>foo[]</li></ol><p>bar</p>'
			},
			{	start: '<ol><li>foo[]</li></ol><p>bar</p>',
				execResult: '<p>foo[]</p><p>bar</p>'
			},
			{	start: '<ul><li>foo[]</li></ul><p>bar</p>',
				execResult: '<ol><li>foo[]</li></ol><p>bar</p>'
			},

			// two lines at start of second
//			{	exclude: ['msie'],
//				start: 'foo<br/>[]bar',
//        execResult: 'foo<ol><li>[]bar</li></ol>'
//			},
            {	include: ['msie'],
				start: 'foo<br/>[]bar',
                execResult: 'foo<br/><ol><li>[]bar</li></ol>'
			},
			{	start: '<p>foo</p><p>[]bar</p>',
				execResult: '<p>foo</p><ol><li>[]bar</li></ol>'
			},
			{	start: '<p>foo</p><ol><li>[]bar</li></ol>',
				execResult: '<p>foo</p><p>[]bar</p>'
			},
			{	start: '<p>foo</p><ul><li>[]bar</li></ul>',
				execResult: '<p>foo</p><ol><li>[]bar</li></ol>'
			},

			// two lines fully selected
//			{	exclude: ['msie'],
//				start: '[foo<br/>bar]',
//				execResult: '<ol><li>[foo</li><li>bar]</li></ol>'
//			},
			{	include: ['msie'],
				start: '[foo<br/>bar]',
                execResult: '<ol><li>[foo<br/></li><li>bar]</li></ol>'
			},
			{	start: '<p>[foo</p><p>bar]</p>',
				execResult: '<ol><li>[foo</li><li>bar]</li></ol>'
			},
			{	start: '<ol><li>[foo</li><li>bar]</li></ol>',
				execResult: '<p>[foo</p><p>bar]</p>'
			},
			{	start: '<ul><li>[foo</li><li>bar]</li></ul>',
				execResult: '<ol><li>[foo</li><li>bar]</li></ol>'
			},

			// nested ol, in outer
//			{	start: '<ol><li>foo[]</li><li>bar<ol><li>baz</li><li>quz</li></ol></li></ol>',
//				execResult: '<p>foo[]</p><ol><li>bar<ol><li>baz</li><li>quz</li></ol></li></ol>'
//			},
			// nested ol, in inner
//			{	start: '<ol><li>foo</li><li>bar<ol><li>baz[]</li><li>quz</li></ol></li></ol>',
//              execResult: '<ol><li>foo</li><li>bar</li><li>baz[]<ol><li>quz</li></ol></li></ol>'
//			},
//
//			// nested ul, in outer
//			{	exclude: ['msie7.0', 'msie8.0'],
//				start: '<ul><li>foo[]</li><li>bar<ul><li>baz</li><li>quz</li></ul></li></ul>',
//              execResult: '<ol><li>foo[]</li></ol><ul><li>bar<ul><li>baz</li><li>quz</li></ul></li></ul>'
//			},
			{	include: ['msie7.0', 'msie8.0'],
				start: '<ul><li>foo[]</li><li>bar<ul><li>baz</li><li>quz</li></ul></li></ul>',
                execResult: '<ol><li>foo[]</li></ol><ul><li>bar <ul><li>baz</li><li>quz</li></ul></li></ul>'
			},
			// nested ul, in inner
//			{	exclude: ['msie7.0', 'msie8.0'],
//				start: '<ul><li>foo</li><li>bar<ul><li>baz[]</li><li>quz</li></ul></li></ul>',
//        execResult: '<ul><li>foo</li><li>bar<ol><li>baz[]</li></ol><ul><li>quz</li></ul></li></ul>'
//			},
			{	include: ['msie7.0', 'msie8.0'],
				start: '<ul><li>foo</li><li>bar<ul><li>baz[]</li><li>quz</li></ul></li></ul>',
                execResult: '<ul><li>foo</li><li>bar <ol><li>baz[]</li></ol><ul><li>quz</li></ul></li></ul>'
			},

			// ol nested in ul, selection in outer
//			{	exclude: ['msie7.0', 'msie8.0'],
//				start: '<ul><li>foo[]</li><li>bar<ol><li>baz</li><li>quz</li></ol></li></ul>',
//        execResult: '<ol><li>foo[]</li></ol><ul><li>bar<ol><li>baz</li><li>quz</li></ol></li></ul>'
//			},
			{	include: ['msie7.0', 'msie8.0'],
				start: '<ul><li>foo[]</li><li>bar<ol><li>baz</li><li>quz</li></ol></li></ul>',
                execResult: '<ol><li>foo[]</li></ol><ul><li>bar <ol><li>baz</li><li>quz</li></ol></li></ul>'
			},
			// ol nested in ul, selection in inner
//			{	start: '<ul><li>foo</li><li>bar<ol><li>baz[]</li><li>quz</li></ol></li></ul>',
//              execResult: '<ul><li>foo</li><li>bar</li><li>baz[]<ol><li>quz</li></ol></li></ul>'
//			},

//			// ul nested in ol, selection in outer
//			{	start: '<ol><li>foo[]</li><li>bar<ul><li>baz</li><li>quz</li></ul></li></ol>',
//				execResult: '<p>foo[]</p><ol><li>bar<ul><li>baz</li><li>quz</li></ul></li></ol>'
//			},
//			// ul nested in ol, selection in inner
//			{	exclude: ['msie7.0', 'msie8.0'],
//				start: '<ol><li>foo</li><li>bar<ul><li>baz[]</li><li>quz</li></ul></li></ol>',
//              execResult: '<ol><li>foo</li><li>bar<ol><li>baz[]</li></ol><ul><li>quz</li></ul></li></ol>'
//			},
			{	include: ['msie7.0', 'msie8.0'],
				start: '<ol><li>foo</li><li>bar<ul><li>baz[]</li><li>quz</li></ul></li></ol>',
				execResult: '<ol><li>foo</li><li>bar <ol><li>baz[]</li><li>quz</li></ol></li></ol>'
			}
		]
	}
	</script>
	<h1 id="qunit-header">Aloha Editor insertOrderedList tests</h1>
	<h2 id="qunit-banner"></h2>
	<div id="qunit-testrunner-toolbar"></div>
	<h2 id="qunit-userAgent"></h2>
	<ol id="qunit-tests"></ol>
	<div id="qunit-fixture"></div>
	<div id="edit" style="margin:20px; border:1px solid #000000;"></div>
	<div id="logBody"></div>
</body>
</html>
